//This class is a job manager to prevent the concurrent job.

jsx3.lang.Class.defineClass("ux.megatron.util.JobManager",
    null,
    null,
    function(manager) {
  				
		var pendingRequests = [];//{identity:'job identity'}
		manager.isPending = function(identity){
			for(var i=0;i<pendingRequests.length;i++){
				if(identity == pendingRequests[i].identity)
					return true;
			}
			return false;
		}
		manager.removeFromPending = function(identity){
			var rid = -1
			for(var i=0;i<pendingRequests.length;i++){
				if(identity == pendingRequests[i].identity){
					rid = i;
					break;
				}
			}
			if(rid != -1) pendingRequests.remove(rid);
		}
		manager.addToPending = function(identity){
			var job = {};
			job.identity = identity;
			pendingRequests.push(job);
		}
    }
);